function [sigma_x, std_sigma_x] = std_est(x)
%% Overview
% The purpose of this file is to take a series x, estimate its standard
% error (sigma_x) and then calculate the standard error on that estimate
% (std_sigma_x).

% Demean
x = x - mean(x);
n = length(x);
mu = mean(x.^4);
var_sigma_squared = (mu-var(x)^2*(n-3)/(n-1))/n; % Variance of sigma^2
sigma_x = std(x);
std_sigma_x = var_sigma_squared^0.5/(2*sigma_x);

end

